package com.senlingspace.payment.enums;

/**
 * 抖音券状态枚举
 *
 * @author lebronjames
 * @date 2024/07/24
 */
public enum DouyinTicketStatusEnum {

    INIT(0, "初始状态"),

    AVAILABLE(1, "未使用"),

    USED(2, "已使用"),

    REFUND_APPLYING(3, "退款申请中(待审核)"),

    REFUND_SUCCESS(4, "退款成功"),

    REFUND_FAILED(5, "退款失败"),

    REFUNDING(6, "退款中"),

    UNKNOWN(-1, "未知");

    private final int code;
    private final String desc;

    DouyinTicketStatusEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static DouyinTicketStatusEnum getTicketStatus(int code) {
        for (DouyinTicketStatusEnum douyinTicketStatusEnum : DouyinTicketStatusEnum.values()) {
            if (douyinTicketStatusEnum.getCode() == code) {
                return douyinTicketStatusEnum;
            }
        }
        return UNKNOWN;
    }

}
